package com.example.usercenter.sys.entity;

import com.example.usercenter.config.GenCodeTemplateConfig;

/**
 * Created by zxn on 2018/1/4.
 */
public class GenCodeTemplate {
    private String tableName;
    private ModelClass entityClass;
    private String entityClassPath;
    private DaoClass daoClass;
    private String daoClassPath;
    private ServiceClass serviceClass;
    private String serviceClassPath;
    private ControllerClass controllerClass;
    private String pageResponseClassPath;
    private String pageResponseClassName;
    private String responseResultClassPath;
    private String responseResultClassName;
    private ColumnModel primaryKey;

    public GenCodeTemplate(){}

    public GenCodeTemplate(TableModel tableModel, GenCodeTemplateConfig config){
        this.tableName = tableModel.getTableName();
        this.primaryKey = tableModel.getPrimaryKeyColumn();
        this.entityClass = new ModelClass(tableModel, config.getEntityPackagePath());
        this.daoClass = new DaoClass(entityClass.getClassName()+"Dao", config.getDaoPackagePath(), config.getBaseDao(), entityClass);
        this.serviceClass = new ServiceClass(entityClass.getClassName()+"Service", config.getServicePackagePath(), config.getBaseService());
        this.controllerClass = new ControllerClass(entityClass.getClassName()+"Controller", config.getControllerPackagePath(), config.getBaseController());
        this.entityClassPath = entityClass.getPackagePath() + "." + entityClass.getClassName();
        this.daoClassPath = daoClass.getPackagePath()+"."+daoClass.getClassName();
        this.serviceClassPath = serviceClass.getPackagePath()+"."+serviceClass.getClassName();
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public ModelClass getEntityClass() {
        return entityClass;
    }

    public void setEntityClass(ModelClass entityClass) {
        this.entityClass = entityClass;
    }

    public String getEntityClassPath() {
        return entityClassPath;
    }

    public void setEntityClassPath(String entityClassPath) {
        this.entityClassPath = entityClassPath;
    }

    public DaoClass getDaoClass() {
        return daoClass;
    }

    public void setDaoClass(DaoClass daoClass) {
        this.daoClass = daoClass;
    }

    public ServiceClass getServiceClass() {
        return serviceClass;
    }

    public void setServiceClass(ServiceClass serviceClass) {
        this.serviceClass = serviceClass;
    }

    public String getServiceClassPath() {
        return serviceClassPath;
    }

    public void setServiceClassPath(String serviceClassPath) {
        this.serviceClassPath = serviceClassPath;
    }

    public ControllerClass getControllerClass() {
        return controllerClass;
    }

    public void setControllerClass(ControllerClass controllerClass) {
        this.controllerClass = controllerClass;
    }

    public String getPageResponseClassPath() {
        return pageResponseClassPath;
    }

    public void setPageResponseClassPath(String pageResponseClassPath) {
        this.pageResponseClassPath = pageResponseClassPath;
    }

    public String getPageResponseClassName() {
        return pageResponseClassName;
    }

    public void setPageResponseClassName(String pageResponseClassName) {
        this.pageResponseClassName = pageResponseClassName;
    }

    public String getResponseResultClassPath() {
        return responseResultClassPath;
    }

    public void setResponseResultClassPath(String responseResultClassPath) {
        this.responseResultClassPath = responseResultClassPath;
    }

    public String getResponseResultClassName() {
        return responseResultClassName;
    }

    public void setResponseResultClassName(String responseResultClassName) {
        this.responseResultClassName = responseResultClassName;
    }

    public ColumnModel getPrimaryKey() {
        return primaryKey;
    }

    public void setPrimaryKeys(ColumnModel primaryKey) {
        this.primaryKey = primaryKey;
    }
}
